package com.utils;

import java.util.Random;

/**
 * @author fanshihao
 * @date 2025-03-26 16:58
 */
public class CaptchaUtil {

    // 生成数字验证码
    public static String generateCaptcha() {

        int length = 6;
        StringBuilder captcha = new StringBuilder();
        Random random = new Random();

        for (int i = 0; i < length; i++) {
            captcha.append(random.nextInt(10)); // 生成 0-9 的数字
        }

        return captcha.toString();
    }

}
